//
//  CapitalSubsidiaryViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/8.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "CapitalSubsidiaryViewController.h"
#import "InformationViewController.h"
#import "AgreementView.h"
#import "InforViewController.h"
#import "InvestmentVC.h"

@interface CapitalSubsidiaryViewController ()

@end

@implementation CapitalSubsidiaryViewController
#define subController @[@"InforViewController",@"InvestmentVC",@"AgreementView"]

-(NSArray<NSString *> *)titles {
    return @[@"项目信息",@"投资记录",@"投资协议"];
}

- (BorrowGetDetailModel *)model {
    if (!_model) {
        _model = [[BorrowGetDetailModel alloc] init];
    }
    return _model;
}

-(instancetype)init{
    
    if (self = [super init]) {
        
        self.menuViewStyle = WMMenuViewStyleLine;
        self.titleSizeNormal = 15;
        self.titleSizeSelected = 17.0;
        self.menuItemWidth = 80;
        self.menuHeight = 40;
    }
    return self;
    
}




#pragma mark --实现WMPageControllerDataSource
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
//    NSLog(@"789");
    return self.titles.count;
    
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
//    NSLog(@"456");
    return self.titles[index];
    
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    
    if (index == 0) {
        InforViewController *informationVC = [[InforViewController alloc] init];
        informationVC.Borrowid = self.Borrowid;
        return informationVC;
    }else if (index == 2){
        AgreementView *agreeView = [[AgreementView alloc] init];
        agreeView.Borrowid = self.Borrowid;
        agreeView.BorrowListid = self.BorrowListId;
        agreeView.num = self.num;
        return agreeView;
    } else {
        InvestmentVC *investment = [[InvestmentVC alloc] init];
        investment.Borrowid = self.Borrowid;
        return investment;
    }
//    UIViewController *subViewController = [[NSClassFromString(subController[index]) alloc] init];
    
    
//    return subViewController;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = [NSString stringWithFormat:@"%@%@",self.ProjectName,self.Code];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@""] style:UIBarButtonItemStylePlain target:self action:nil];
    
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    
    
    //大于7.0版本设置
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
        self.extendedLayoutIncludesOpaqueBars = NO;
        self.modalPresentationCapturesStatusBarAppearance = NO;
    }
    
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:NO animated:NO];
   
}




@end
